//引入reuest请求
const {
  request
} = require('./request')
//基于业务封装的数据请求
module.exports = {
  /**
   *   获取分类接口
   */
  getList: () => {
    return request('/shop/goods/category/all', 'GET', {}, true);
  },
  /**
   *   获取轮播图接口
   */
  getswipsrc: () => {
    return request('/banner/list', 'GET', {}, true);
  },
  /**
   *   获取商品列表接口
   */
  getproductlist: () => {
    return request('/shop/goods/list/v2', 'POST', {}, true);
  },
  /**
   *   获取分类左边接口
   */
  getListleft: (id) => {
    return request('/shop/goods/category/all?id=' + id, 'GET', {}, true);
  },
  /**
   *   获取分类右边接口
   */
  getListright: (id) => {
    return request('/shop/goods/list/v2', 'POST', {
      categoryId: id
    }, true);
  },
  /**
   *   获取商品详情接口
   */
  getdetaildate: (id) => {
    return request('/shop/goods/detail', 'GET', {
      id: id
    }, true);
  },
  /**
   *   获取购物车价格接口
   */
  getsopcarprice: (i, e) => {
    return request('/shop/goods/price', 'POST', {
      goodsId: i,
      propertyChildIds: e
    }, true);
  },
  /**
   *   添加到购物车接口
   */
  getaddsoopcar: (id, num, token, sku) => {
    return request('/shopping-cart/add', 'POST', {
      goodsId: id,
      number: num,
      token: token,
      sku: sku
    }, true);
  },
  /**
   *   读取购物车接口
   */
  getreadsoopcar: (token) => {
    return request('/shopping-cart/info', 'GET', {
      token: token
    }, true);
  },
  /**
   *   购物车修改购买数量
   */
  getamendsoopcarnum: (key, num, token) => {
    return request('/shopping-cart/modifyNumber', 'POST', {
      key: key,
      number: num,
      token: token
    }, true);
  },
    /**
   *   移除单项商品
   */
  getaremovelistsoopcar: (key,token) => {
    return request('/shopping-cart/remove', 'POST', {
      key: key,
      token: token
    }, true);
  },

}